<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>FLxyin</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="FLvslidBnk2.html" title="FLvslidBnk2" />
    <link rel="next" href="fmb3.html" title="fmb3" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">FLxyin</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="FLvslidBnk2.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="fmb3.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="FLxyin"></a>
      <div class="titlepage"></div>
      <a id="IndexFLxyin" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">FLxyin</span>
        </h2>
        <p>FLxyin — 
      Senses the mouse cursor position in a user-defined area inside an FLpanel.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp109392896"></a>
        <h2>Description</h2>
        <p>
      Similar to <a class="link" href="xyin.html" title="xyin"><em class="citetitle">xyin</em></a>, sense the mouse cursor position in a user-defined area inside an FLpanel.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp109395072"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">koutx, kouty, kinside  <span class="command"><strong>FLxyin</strong></span> ioutx_min, ioutx_max, iouty_min, iouty_max, \
      iwindx_min, iwindx_max, iwindy_min, iwindy_max [, iexpx, iexpy, ioutx, iouty]</pre>
      </div>
      <div class="refsect1">
        <a id="idp109397392"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ioutx_min, ioutx_max</em></span> - the minimum and maximum limits of the interval to be output (X or horizontal axis).
    </p>
        <p>
      <span class="emphasis"><em>iouty_min, iouty_max </em></span> - the minimum and maximum limits of the interval to be output (Y or vertical axis).
    </p>
        <p>
      <span class="emphasis"><em>iwindx_min, iwindx_max</em></span> - the X coordinate of the horizontal edges of the sensible area, relative to the FLpanel ,in pixels.
    </p>
        <p>
      <span class="emphasis"><em>iwindy_min, iwindy_max</em></span>  - the Y coordinates of the vertical edges of the sensible area, relative to the FLpanel, in pixels.
    </p>
        <p>
      <span class="emphasis"><em>iexpx, iexpy</em></span> - (optional) integer numbers denoting the behavior of the x or y output: 0 -&gt; output is linear; -1 -&gt; output is exponential; any other number indicates the number of an existing table that is used for indexing. With a positive value for table number, linear interpolation is provided in table indexing. A negative table number suppresses interpolation. Notice that in normal operations, the table should be normalized and unipolar (i.e. all table elements should be in the zero to one range). In this case all table elements will be rescaled according to imax and imin. Anyway, it is possible to use non-normalized tables (created with a negative table number, that can contain elements of any value), in order to access the actual values of table elements, without rescaling, by assigning 0 to iout_min and 1 to iout_max.
    </p>
        <p>
      <span class="emphasis"><em>ioutx, iouty</em></span> – (optional) initial output values.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp109404416"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>koutx, kouty</em></span> - output values, scaled according to user choices.
    </p>
        <p>
      <span class="emphasis"><em>kinside</em></span> - a flag that informs if the mouse cursor falls out of the rectangle of the user-defined area. If it is out of the area, kinside is set to zero.
    </p>
        <p>
      <span class="emphasis"><em>FLxyin</em></span> senses the mouse cursor position in a user-defined area inside an <a class="link" href="FLpanel.html" title="FLpanel"><em class="citetitle">FLpanel</em></a>. When <span class="emphasis"><em>FLxyin</em></span> is called, the position of the mouse within the chosen area is returned at k-rate. It is possible to define the sensible area, as well the minimum and maximum values corresponding to the minimum and maximum mouse positions. Mouse buttons don’t need to be pressed to make <span class="emphasis"><em>FLxyin</em></span> to operate. It is able to function correctly even if other widgets (present in the <a class="link" href="FLpanel.html" title="FLpanel"><em class="citetitle">FLpanel</em></a>) overlap the sensible area.
    </p>
        <p>
      <span class="emphasis"><em>FLxyin</em></span> unlike most other FLTK opcodes can't be used inside the header, since it is not a widget. It is just a definition of an area for mouse sensing within an FLTK panel.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp109412272"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the FLxyin opcode. It uses the file <a class="ulink" href="examples/FLxyin.csd" target="_top"><em class="citetitle">FLxyin.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp109414128"></a>
          <p class="title">
            <strong>Example 297. Example of the FLxyin opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in</span>
-odac           -iadc    <span class="comment">;;;RT audio I/O</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span><span class="op">=</span>48000
<span class="ohdr">ksmps</span><span class="op">=</span>128
<span class="ohdr">nchnls</span><span class="op">=</span>2

<span class="comment">; Example by Andres Cabrera 2007</span>

<span class="opc">FLpanel</span>	"FLxyin", 200, 100, <span class="op">-</span>1, <span class="op">-</span>1, 3
<span class="opc">FLpanelEnd</span>
<span class="opc">FLrun</span>

<span class="oblock">instr</span> 1
  koutx, kouty, kinside <span class="opc">FLxyin</span> 0, 10, 100, 1000, 10, 190, 10, 90
  aout <span class="opc">buzz</span> 10000, kouty, koutx, 1
  <span class="opc">printk2</span> koutx
  <span class="opc">outs</span> aout, aout
<span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">f</span> 1 0 1024 10 1
<span class="stamnt">i</span> 1 0 3600

<span class="stamnt">e</span>

<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
        <p>
      Here is another example of the FLxyin opcode. It uses the file <a class="ulink" href="examples/FLxyin-2.csd" target="_top"><em class="citetitle">FLxyin-2.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp109419408"></a>
          <p class="title">
            <strong>Example 298. Example of the FLxyin opcode.</strong>
          </p>
          <div class="example-contents">
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span><span class="op">=</span>44100
<span class="ohdr">kr</span><span class="op">=</span>441
<span class="ohdr">ksmps</span><span class="op">=</span>100
<span class="ohdr">nchnls</span><span class="op">=</span>2

<span class="comment">; Example by Gabriel Maldonado</span>

	<span class="opc">FLpanel</span>	"Move the mouse inside this panel to hear the effect",400,400
	<span class="opc">FLpanel_end</span>
	<span class="opc">FLrun</span>

	<span class="oblock">instr</span> 1

k1, k2, kinside	<span class="opc">FLxyin</span>   50, 1000, 50, 1000, 100, 300, 50, 250, <span class="op">-</span>2,<span class="op">-</span>3
<span class="comment">;if k1 &lt;= 50 || k1 &gt;=5000 || k2 &lt;=100 || k2 &gt;= 8000 kgoto end ; if cursor is outside bounds, then don't play!!!</span>

a1	<span class="opc">oscili</span>	3000, k1, 1
a2	<span class="opc">oscili</span>	3000, k2, 1

	<span class="opc">outs</span>	a1,a2
<span class="opc">printk2</span> k1
<span class="opc">printk2</span> k2, 10
<span class="opc">printk2</span> kinside, 20
<span class="olabel">end</span><span class="op">:</span>
	<span class="oblock">endin</span>
	
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">f</span>1 0 1024 10 1
<span class="stamnt">f</span>2 0 17 19 1 1 90 1
<span class="stamnt">f</span>3 0 17 19 2 1 90 1
<span class="stamnt">i</span>1 0 3600

<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp109421328"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="FLpanel.html" title="FLpanel"><em class="citetitle">FLpanel</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp109423376"></a>
        <h2>Credits</h2>
        <p>Author: Gabriel Maldonado</p>
        <p>New in version 5.06</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="FLvslidBnk2.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="fmb3.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">FLvslidBnk2 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> fmb3</td>
        </tr>
      </table>
    </div>
  </body>
</html>
